// Define this to enable blur background to winlist
//#define BLUR_WINLIST 1

// Some values used if blur is enabled
#define BLUR_WINLIST_AMOUNT "48"

group { name: "e/widgets/winlist/main";
   parts {
      part { name: "base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            color_class: "/bg/normal/winlist/base";
         }
      }
      part { name: "e.text.title"; type: TEXT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.relative: 0.0 0.0;
            rel1.offset: 8 8;
            rel2.relative: 1.0 0.0;
            rel2.offset: -9 8;
            align: 0.5 0.0;
            color_class: "/fg/normal/winlist/text/title";
            offscale;
            text { font: FNBD; size: 10;
               text_class: "winlist_title";
               align: 0.5 0.0;
               min: 0 1;
            }
            fixed: 0 1;
            offscale;
         }
      }
      part { name: "e.swallow.icon"; type: SWALLOW;
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.0;
            FIXED_SIZE(80, 80)
            rel1.relative: 0.0 1.0;
            rel1.offset: 8 8;
            rel1.to_y: "e.text.title";
            rel2.relative: 1.0 1.0;
            rel2.offset: -9 8;
            rel2.to_y: "e.text.title";
            offscale;
         }
      }
      part { name: "win"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            rel.to: "e.swallow.icon";
            rel1.relative: 1.0 0.0;
            rel1.offset: 8 0;
            rel2.relative: 2.0 1.0;
            FIXED_SIZE(80, 80)
            offscale;
         }
      }
      part { name: "e.swallow.win"; type: SWALLOW;
         description { state: "default" 0.0;
            rel.to: "win";
         }
      }
      part { name: "e.text.label"; type: TEXT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.relative: 1.0 0.0;
            rel1.offset: 8 0;
            rel1.to: "win";
            rel2.offset: -9 -9;
            rel2.to_y: "win";
            align: 0.0 0.5;
            color_class: "/fg/normal/winlist/text/label";
            text { font: FNBD; size: 10;
               text_class: "winlist_label";
               align: 0.0 0.5;
               min: 0 1;
            }
            fixed: 0 1;
            offscale;
         }
      }
      part { name: "list_clip"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.relative: 0.0 1.0;
            rel1.offset: 0 8;
            rel1.to_y: "e.swallow.icon";
            rel2.offset: -1 -9;
            offscale;
         }
      }
      part { name: "e.swallow.list"; type: SWALLOW;
         clip_to: "list_clip";
         description { state: "default" 0.0;
            rel1.to_y: "list_clip";
            rel2.to_y: "list_clip";
         }
      }
   }
}

group { name: "e/widgets/winlist/item";
   parts {
      part { name: "sel_base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            color_class: "/bg/selected/winlist/item/base";
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "clip_normal"; type: RECT;
         description { state: "default" 0.0;
            visible: 1;
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "clip_iconified"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "e.text.label"; type: TEXT; mouse_events: 0;
         clip_to: "clip_normal";
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 8 8;
            rel1.relative: 1.0 0.0;
            rel1.to_x: "win";
            rel2.offset: -9 -9;
            color_class: "/fg/normal/winlist/item/text/normal";
            offscale;
            min: 0 40;
            text { font: FN; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "winlist_item";
            }
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/winlist/item/text/normal";
         }
      }
      part { name: "label2"; type: TEXT; mouse_events: 0;
         clip_to: "clip_iconified";
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "e.text.label";
            color_class: "/fg/normal/winlist/item/text/iconified";
            text { font: FN; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "winlist_item";
               text_source: "e.text.label";
            }
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/winlist/item/text/iconified";
         }
      }
      part { name: "icon"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            rel1.offset: 8 8;
            rel2.relative: 0.0 1.0;
            rel2.offset: 8 -9;
            FIXED_SIZE(40, 40)
            offscale;
         }
      }
      part { name: "win"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            align: 0.0 0.5;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            rel.to: "icon";
            rel1.relative: 1.0 0.0;
            rel1.offset: 8 0;
            rel2.relative: 2.0 1.0;
            FIXED_SIZE(40, 40)
            offscale;
         }
      }
      part { name: "e.swallow.icon"; type: SWALLOW; mouse_events: 0;
         description { state: "default" 0.0;
            rel.to: "icon";
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.25 0.25;
            rel2.relative: 0.75 0.75;
        }
      }
      part { name: "e.swallow.win"; type: SWALLOW; mouse_events: 0;
         description { state: "default" 0.0;
            rel.to: "win";
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.25 0.25;
            rel2.relative: 0.75 0.75;
        }
      }
      part { name: "event"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
      program { signal: "e,state,selected"; source: "e";
         action: STATE_SET "selected" 0.0;
         target: "sel_base";
         target: "e.text.label";
         target: "label2";
      }
      program { signal: "e,state,unselected"; source: "e";
         action: STATE_SET "default" 0.0;
         target: "sel_base";
         target: "e.text.label";
         target: "label2";
      }
      program { signal: "e,state,iconified"; source: "e";
         action: STATE_SET "iconified" 0.0;
         target: "clip_normal";
         target: "clip_iconified";
      }
      program { signal: "e,state,invisible"; source: "e";
         action: STATE_SET "iconified" 0.0;
         target: "clip_normal";
         target: "clip_iconified";
      }
//      program {
//         signal: "e,state,shaded"; source: "e";
//      }
   }
}

////////////////////////////////////////////////////////////////////////////

group { name: "e/widgets/winlist/large/bg";
   alias: "e/widgets/winlist/bg";
// disable blur and the circular shadow - they are pricey - esp blur by far
// on older gpu's.... whilst it looks nice, it just is too costly. keep here
// for information so can turn on maybe with ifdefs and alternate build that
// turnns on costly expensive things like this
//   images.image: "screen_circular_shadow.png" COMP;
   parts {
      part { name: "bg_clip"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
            color: 255 255 255 0; // no cc
         }
         description { state: "visible" 0.0;
            inherit: "default" 0.0;
            visible: 1;
            color: 255 255 255 255; // no cc
         }
      }
#ifdef BLUR_WINLIST
      snapshot { "bg_blur";
         clip_to: "bg_clip";
         description { state: "default" 0.0;
            filter.code: "padding_set { 0 } blur { state.pos * "BLUR_WINLIST_AMOUNT", color = '#ffff' }";
            visible: 0;
         }
         desc { state: "visible" 0.0;
            inherit: "default" 0.0;
            filter.code: "padding_set { 0 } blur { (1.0 - state.pos) * "BLUR_WINLIST_AMOUNT", color = '#ffff' }";
            visible: 1;
         }
      }
#endif
      part { name: "bg_darken"; type: RECT;
         clip_to: "bg_clip";
         description { state: "default" 0.0;
            color_class: "/dim/normal/winlist/base";
         }
      }
#ifdef BLUR_WINLIST
      part { name: "shadow"; mouse_events: 0;
         clip_to: "bg_clip";
         description { state: "default" 0.0;
            rel1.relative: -1.0 -1.0;
            rel2.relative: 2.0 2.0;
            image.normal: "screen_circular_shadow.png";
            fill.smooth: 0;
            visible: 0;
         }
         description { state: "visible" 0.0;
            inherit;
            rel1.relative: 0.0 0.0;
            rel2.relative: 1.0 1.0;
            visible: 1;
         }
      }
#endif
   }
   programs {
      program { signal: "e,state,visible,on"; source: "e";
         action: STATE_SET "visible" 0.0;
         transition: DECELERATE 0.2 USE_DURATION_FACTOR 1 CURRENT;
         target: "bg_clip";
#ifdef BLUR_WINLIST
         target: "bg_blur";
         target: "shadow";
#endif
         after: "show2";
      }
      program { name: "show2";
         action: SIGNAL_EMIT "e,action,show,done" "e";
      }
      program { signal: "e,state,visible,off"; source: "e";
         action: STATE_SET "default" 0.0;
         transition: ACCELERATE 0.2 USE_DURATION_FACTOR 1 CURRENT;
         target: "bg_clip";
#ifdef BLUR_WINLIST
         target: "bg_blur";
         target: "shadow";
#endif
         after: "hide2";
      }
      program { name: "hide2";
         action: SIGNAL_EMIT "e,action,hide,done" "e";
      }
   }
}

group { name: "e/widgets/winlist/large/fg";
   alias: "e/widgets/winlist/fg";
   parts {
      part { name: "fg_darken"; type: RECT;
         description { state: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
      program { signal: "e,state,visible,on"; source: "e";
         action: SIGNAL_EMIT "e,action,show,done" "e";
      }
      program { signal: "e,state,visible,off"; source: "e";
         action: SIGNAL_EMIT "e,action,hide,done" "e";
      }
   }
}

group { name: "e/widgets/winlist/large";
   data.item: "noshadow" "1";
   parts {
      part { name: "list_clip"; type: RECT;
         description { state: "default" 0.0;
         }
      }
      part { name: "e.swallow.list"; type: SWALLOW;
         clip_to: "list_clip";
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "list_clip";
            rel1.offset: 8 8;
            rel2.offset: -9 -9;
            offscale;
         }
      }
   }
}

group { name: "e/widgets/winlist/item_large";
   parts {
      part { name: "sel_base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            color_class: "/bg/selected/winlist/large/item";
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "icon"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            rel.to: "e.swallow.win";
            align: 1.0 1.0;
            rel1.offset: 8 8;
            rel2.offset: -9 -9;
            min: 40 40;
            max: 40 40;
            offscale;
         }
      }
      part { name: "e.swallow.win"; type: SWALLOW; mouse_events: 0;
         description { state: "default" 0.0;
            rel1.offset: 16 16;
            rel2.offset: -17 -17;
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.25 0.25;
            rel2.relative: 0.75 0.75;
        }
      }
      part { name: "backing"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.to: "e.text.label";
            rel2.to: "e.swallow.icon";
            rel1.offset: -8 -8;
            rel2.offset: 7 7;
            color_class: "/dim/normal/winlist/item/text";
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/dim/selected/winlist/item/text";
         }
      }
      part { name: "e.text.label"; type: TEXT; mouse_events: 0;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: 8 0;
            rel1.relative: 0.0 0.0;
            rel1.to_x: "e.swallow.win";
            rel1.to_y: "icon";
            rel2.offset: -9 -1;
            rel2.relative: 0.0 1.0;
            rel2.to: "icon";
            color_class: "/fg/normal/winlist/item/text/normal";
            offscale;
            text { font: FNBD; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "winlist_item";
            }
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/selected/winlist/item/text/normal";
         }
      }
      part { name: "e.swallow.icon"; type: SWALLOW; mouse_events: 0;
         description { state: "default" 0.0;
            rel.to: "icon";
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.25 0.25;
            rel2.relative: 0.75 0.75;
        }
      }
      part { name: "event"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
         description { state: "iconified" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
      program { signal: "e,state,selected"; source: "e";
         action: STATE_SET "selected" 0.0;
         target: "sel_base";
         target: "e.text.label";
         target: "backing";
      }
      program { signal: "e,state,unselected"; source: "e";
         action: STATE_SET "default" 0.0;
         target: "sel_base";
         target: "e.text.label";
         target: "backing";
      }
      program { signal: "e,state,iconified"; source: "e";
         action: STATE_SET "iconified" 0.0;
         target: "e.swallow.icon";
      }
      program { signal: "e,state,invisible"; source: "e";
         action: STATE_SET "iconified" 0.0;
         target: "e.swallow.icon";
      }
//      program {
//         signal: "e,state,shaded"; source: "e";
//      }
   }
}
